home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 18 / Silicon_Graphics_hot mix 18.iso / .bin / hotmix18.csh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1998-02-23  |  8KB  |  219 lines

  1. #! /bin/csh -f 
  2.  
  3. ##########################################################
  4. #
  5. #       Check Operating System version #
  6. #
  7. ##########################################################
  8.  
  9. setenv OSVERSION `/sbin/uname -r`
  10.  
  11. @ ver = `/sbin/uname -r | cut -c1,3`
  12. setenv OSVER $ver
  13.  
  14. if ($ver <= 52 || $ver == 60 || $ver >= 65)  then
  15.         set answer = `$HOTMIXDIR/.bin/wrongOS`
  16.         if ($answer == 0) then 
  17.                 echo " "
  18.                 echo "EXITing, Good-Bye"
  19.                 echo " "
  20.                 exit 0
  21.         endif
  22. endif
  23.  
  24. ##########################################################
  25. #
  26. #       Set envir variables
  27. #
  28. ##########################################################
  29.  
  30. unalias *
  31. alias cd cd
  32. set filec
  33. setenv USERNAME `/usr/bin/whoami`
  34. setenv HOSTNAME `/sbin/uname -n`
  35. setenv DOMAINNAME `$HOTMIXDIR/.bin/domainname`
  36.  
  37. ##########################################################
  38. #
  39. #      NEED to find a writeable tmp directory
  40. #
  41. ##########################################################
  42.  
  43.         if (-w /usr/tmp) then
  44.            setenv TMPFILEDIR "/usr/tmp"
  45.         else if (-w /tmp) then
  46.            setenv TMPFILEDIR "/tmp"
  47.         else if (-w $HOME) then
  48.            setenv TMPFILEDIR $HOME
  49.         endif
  50.  
  51. setenv SHOWMESS $HOTMIXDIR/.bin/showmess
  52.  
  53. set path=($HOTMIXDIR/.bin /usr/bin/X11 /usr/sbin . $TMPFILEDIR $path)
  54.  
  55. ##########################################################
  56. #
  57. #       Tell user that this may load slow the first time #
  58. #
  59. ##########################################################
  60.  
  61. if !(-e "$HOME/.netscape/preferehm18") then
  62.     set garbage=`/usr/bin/X11/xconfirm -icon info -t "Hot Mix 18 is loading Netscape 3 from the CD. This may take a few moments to load the first time you use the CD." \
  63. -t " "  \
  64. -t "Press continue." -B Continue` &
  65.  
  66. endif
  67.  
  68. ##########################################################
  69. #
  70. #       Set the (app-defaults, X-resources, $path) paths 
  71. #
  72. ##########################################################
  73.  
  74. if ( ! ${?XUSERFILESEARCHPATH} ) then
  75.     if ("$HOME" == "/") then
  76.         setenv XUSERFILESEARCHPATH "/.desktop-`hostname`/%N:/tmp/.hotmix/app-defaults/%N:/tmp/.hotmix/app-defaults/%N%C:$HOME/%N:/usr/lib/X11/app-defaults/%N:/usr/lib/X11/app-defaults/%L/%N%C:/usr/lib/X11/app-defaults/%l/%N%C:/usr/lib/X11/app-defaults/%N%C:/usr/lib/X11/app-defaults/%L/%N:/usr/lib/X11/app-defaults/%l/%N"
  77.     else
  78.         setenv XUSERFILESEARCHPATH "$HOME/.desktop-`hostname`/%N:/tmp/.hotmix/app-defaults/%N:/tmp/.hotmix/app-defaults/%N%C:$HOME/%N:/usr/lib/X11/app-defaults/%N:/usr/lib/X11/app-defaults/%L/%N%C:/usr/lib/X11/app-defaults/%l/%N%C:/usr/lib/X11/app-defaults/%N%C:/usr/lib/X11/app-defaults/%L/%N:/usr/lib/X11/app-defaults/%l/%N"
  79.     endif
  80. else
  81.     if ("$HOME" == "/") then
  82.         setenv XUSERFILESEARCHPATH "/.desktop-`hostname`/%N:/tmp/.hotmix/app-defaults/%N:/tmp/.hotmix/app-defaults/%N%C:/%N:/usr/lib/X11/app-defaults/%N:/usr/lib/X11/app-defaults/%L/%N%C:/usr/lib/X11/app-defaults/%l/%N%C:/usr/lib/X11/app-defaults/%N%C:/usr/lib/X11/app-defaults/%L/%N:/usr/lib/X11/app-defaults/%l/%N:${XUSERFILESEARCHPATH}"
  83.     else
  84.         setenv XUSERFILESEARCHPATH "$HOME/.desktop-`hostname`/%N:/tmp/.hotmix/app-defaults/%N:/tmp/.hotmix/app-defaults/%N%C:/%N:/usr/lib/X11/app-defaults/%N:/usr/lib/X11/app-defaults/%L/%N%C:/usr/lib/X11/app-defaults/%l/%N%C:/usr/lib/X11/app-defaults/%N%C:/usr/lib/X11/app-defaults/%L/%N:/usr/lib/X11/app-defaults/%l/%N:${XUSERFILESEARCHPATH}"
  85.     endif
  86. endif
  87.  
  88.  
  89. ##########################################################
  90. #
  91. #       Set path for libraries
  92. #
  93. ##########################################################
  94.  
  95. setenv NPX_PLUGIN_PATH /usr/local/lib/netscape/plugins:/var/netscape/communicator/plugins
  96.  
  97. setenv CLASSPATH $HOTMIXDIR/.bin/netscape/classes:.
  98.  
  99. if ( ! ${?LD_LIBRARY_PATH} ) then
  100.     setenv LD_LIBRARY_PATH /usr/lib:/lib:/lib/cc:/usr/lib/cc:/usr/local/lib:.
  101. endif
  102.  
  103. if ( ! ${?LD_LIBRARYN32_PATH} ) then
  104.     setenv LD_LIBRARYN32_PATH /usr/lib32:/lib32
  105. endif
  106.  
  107. if ( ! ${?LD_LIBRARY64_PATH} ) then
  108.     setenv LD_LIBRARYN32_PATH /usr/lib64:/lib64
  109. endif
  110.  
  111. ##########################################################
  112. #
  113. #       Set environ for netscape
  114. #
  115. ##########################################################
  116.  
  117. LOOP:
  118. if (-e "$HOME/.netscape/") then
  119.    if (-w "$HOME/.netscape/") then
  120.         if (-e "$HOME/.netscape/preferences") then
  121.                 nawk -f $HOTMIXDIR/.bin/awkzilla.awk \
  122.             $HOME/.netscape/preferences \
  123.             > $HOME/.netscape/preferehm18
  124.                 chmod 777 $HOME/.netscape/preferehm18
  125.     else if (-e "$HOME/.netscape/preferences.js") then
  126.         $HOTMIXDIR/.bin/perl $HOTMIXDIR/.bin/423.pl $HOME/.netscape/preferences.js \
  127.             $HOTMIXDIR/.bin/netscape/preferehm18 \
  128.             > $HOME/.netscape/preferehm18.tmp
  129.         nawk -f $HOTMIXDIR/.bin/awkzilla.awk \
  130.             $HOME/.netscape/preferehm18.tmp    \
  131.             > $HOME/.netscape/preferehm18
  132.         rm $HOME/.netscape/preferehm18.tmp
  133.                 chmod 777 $HOME/.netscape/preferehm18
  134.         else
  135.                 nawk -f $HOTMIXDIR/.bin/awkzilla.awk \
  136.             $HOTMIXDIR/.bin/netscape/preferehm18 \
  137.             > $HOME/.netscape/preferehm18
  138.                 chmod 777 $HOME/.netscape/preferehm18
  139.         endif
  140.     if (! -e "$HOME/.bookmarks_hm18.html" ) then
  141.             cp $HOTMIXDIR/.bin/netscape/bookmarks_hm18.html \
  142.         $HOME/.netscape/
  143.                 chmod 777 $HOME/.netscape/bookmarks_hm18.html
  144.     endif
  145.     #if ($ver != 62 )  then
  146.         #nawk -f $HOTMIXDIR/.bin/awkzilla3.awk \
  147.         #$HOME/.netscape/preferehm18 \
  148.                 #> $HOME/.netscape/preferehm18.new
  149.         #cp $HOME/.netscape/preferehm18.new $HOME/.netscape/preferehm18
  150.     #endif
  151.     if (! -e "$HOME/.netscape/java_301") then
  152.         cp $HOTMIXDIR/.bin/netscape/java_301 $HOME/.netscape/
  153.     endif
  154.  
  155.   else 
  156.     /usr/bin/X11/xconfirm -icon warning \
  157.         -t "Cannot Write to the $HOME/.netscape directory" \
  158.         -t " " \
  159.         -t "You need to have write permissions for the $HOME/.netscape home directory\!" \
  160.         -t "This will end this session of Hot Mix...." \
  161.         -t " " \
  162.         -b Ok
  163.         exit 
  164.   endif
  165. else
  166.   if (-w $HOME) then
  167.         mkdir $HOME/.netscape/
  168.            if (-e "$HOME/.netscape-preferences") then
  169.             setenv ORIGSOCKSHOSTS `grep SOCKS_HOST $HOME/.netscape-preferences|awk '{print $2}'`
  170.             echo ORIGSOCKSHOSTS=$ORIGSOCKSHOSTS
  171.             nawk -f $HOTMIXDIR/.bin/awkzilla2.awk \
  172.                 $HOTMIXDIR/.bin/netscape/preferehm18 \
  173.                 > $HOME/.netscape/preferences
  174.         endif
  175.         goto LOOP
  176.   else 
  177.         /usr/bin/X11/xconfirm -icon warning \
  178.         -t "Cannot Write to the $HOME directory" \
  179.         -t " " \
  180.         -t "You need to have write permissions for the $HOME directory\!" \
  181.         -t "This will end this session of Hot Mix...." \
  182.         -t " " \
  183.         -b Ok
  184.         exit
  185.   endif 
  186. endif
  187.  
  188. ##########################################################
  189. #
  190. #       Add /tmp/.hotmix/netscape
  191. #
  192. ##########################################################
  193.  
  194. if ( -w /tmp && ! -e /tmp/.hotmix/app-defaults) then
  195.     mkdir /tmp/.hotmix
  196.     cp -r $HOTMIXDIR/.bin/netscape/app-defaults /tmp/.hotmix
  197.     cp $HOTMIXDIR/.bin/netscape/animation.dat /tmp/.hotmix
  198. endif
  199.  
  200. if ( -r /tmp/.hotmix/app-defaults/Netscape.cfg && -r /tmp/.hotmix/app-defaults/Netscape ) then
  201.  
  202. cd $HOME
  203.  
  204.     # Before trying to resize vendor area
  205.     #$HOTMIXDIR/.bin/netscape/netscape.lock -geometry 738x780 -xrm "*strings.22130:This process will either Install, Launch or Remove\nsoftware from the Hot Mix 18 CD.\n\nProceed?\n" file:$HOTMIXDIR/html/index.html
  206.     $HOTMIXDIR/.bin/netscape/netscape.lock -geometry 780x925 -xrm "*strings.22130:This process will either Install, Launch or Remove\nsoftware from the Hot Mix 18 CD.\n\nProceed?\n" file:$HOTMIXDIR/html/index.html
  207. else
  208.     $HOTMIXDIR/.bin/netscape/netscape -geometry 878x823 -xrm "*strings.22130:This process will either Install, Launch or Remove\nsoftware from the Hot Mix 18 CD.\n\nProceed?\n" file:$HOTMIXDIR/html/index.html
  209. endif
  210.  
  211. ##########################################################
  212. #
  213. #       Clean up
  214. #
  215. ##########################################################
  216.  
  217. exit
  218.  
  219.